# coding=utf-8
import sys


from flask import Flask,request

import flask_restful
from flask_restful import Resource

app = Flask(__name__)
api = flask_restful.Api(app)

todos={}

class HelloWorld(flask_restful.Resource):
    def get(self):
        return {'hello': 'world'}


class TodoSimple(Resource):
        def get(self,todo_id):
            return {todo_id: todos[todo_id]}

        def put(self, todo_id):
            todos[todo_id] = request.form['data']
            return {todo_id: todos[todo_id]}



api.add_resource(HelloWorld, '/')
api.add_resource(TodoSimple, '/<string:todo_id>')


if __name__ == '__main__':
    app.run(host='0.0.0.0',port='8888')